const express = require("express");
const router = express.Router();
const pool = require("../../../src/pg/config/pg");
//添加数据
router.post("/add", async (req, res) => {
    const name = req.body.name;
  console.log(name)
    
    const  content = req.body.content;
 
  console.log(content)
    await pool.query(
      " insert into  chat ( name,   content ) values (   ($1),  ($2) );",
      [name,  content],
      (err) => {
        if (err) {
          return res.status(200).json("数据添加失败");
          res.end;
        }
        res.status(200).json("数据添加成功");
        res.end;
      }
    );
  });
module.exports = router